﻿using System;
using com.guojin.core.io;
using com.guojin.core.io.message;
using System.Collections.Generic;

namespace com.guojin.mj.net.message.club
{
    class ClubInfoRet : Message
    {
        public static int TYPE = 7;
        public static int ID = 36;

        private int _joinClub;     //是否加入俱乐部  0 没有  1 加入 2 审核中
        private String _clubId;    //如果加入或审核俱乐部Id
        private String _clubName; //俱乐部名字
        private String _createUserName; //创建者游戏姓名
        private int _peopleNum;   //俱乐部人数
        private int _roomCard;    //俱乐部房卡
        private List<ClubPlayerStateChange> _playerInfoList = new List<ClubPlayerStateChange>();  //玩家状态列表
        private List<ClubRoomListRet> _roomInfoList = new List<ClubRoomListRet>();     //房间信息列表

        public int JoinClub
        {
            get
            {
                return _joinClub;
            }

            set
            {
                _joinClub = value;
            }
        }

        public string ClubId
        {
            get
            {
                return _clubId;
            }

            set
            {
                _clubId = value;
            }
        }

        public string ClubName
        {
            get
            {
                return _clubName;
            }

            set
            {
                _clubName = value;
            }
        }

        public string CreateUserName
        {
            get
            {
                return _createUserName;
            }

            set
            {
                _createUserName = value;
            }
        }

        public int PeopleNum
        {
            get
            {
                return _peopleNum;
            }

            set
            {
                _peopleNum = value;
            }
        }

        public int RoomCard
        {
            get
            {
                return _roomCard;
            }

            set
            {
                _roomCard = value;
            }
        }

        public List<ClubPlayerStateChange> PlayerInfoList
        {
            get
            {
                return _playerInfoList;
            }

            set
            {
                _playerInfoList = value;
            }
        }

        public List<ClubRoomListRet> RoomInfoList
        {
            get
            {
                return _roomInfoList;
            }

            set
            {
                _roomInfoList = value;
            }
        }

        public void decode(Input _in)
        {
            _joinClub = _in.readInt();
            if (_joinClub == 0) { return; }
            ClubId = _in.readString();
            if (_joinClub == 2) { return; }
            ClubName = _in.readString();
            CreateUserName = _in.readString();
            PeopleNum = _in.readInt();
            RoomCard = _in.readInt();

            int len = _in.readInt();
            if (len > 0)
            {
                for (int i = 0; i < len; i++)
                {
                    ClubPlayerStateChange cpi = new ClubPlayerStateChange();
                    cpi.decode(_in);
                    PlayerInfoList.Add(cpi);
                }          
            }

            int len2 = _in.readInt();
            if (len2 > 0)
            {
                for (int i = 0; i < len2 ; i++)
                {
                    ClubRoomListRet cri = new ClubRoomListRet();
                    cri.decode(_in);
                    RoomInfoList.Add(cri);
                }
            }
        }

        public void encode(Output _out)
        {
        }

        public int getMessageType()
        {
            return TYPE;
        }

        public int getMessageId()
        {
            return ID;
        }

        public string toString()
        {
            return string.Format("joinClub={0}, clubId = {1}, clubName= {2}, createUserName= {3},  peopleNum= {4}, roomCardTex={5}",
                _joinClub, _clubId,_clubName,_createUserName,_peopleNum,_roomCard);

        }
    }
}
